﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SimpleFactoryPattern.ProductFactory
{
    /// <summary>
    /// 工厂角色
    /// </summary>
    class Factory
    {
        /// <summary>
        /// 静态工厂方法
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        public static Product GetProduct(string arg) 
        {
            Product product = null;
            if (arg.Equals("A"))
            {
                product = new ContreteProductA();
            }
            else
            {
                product = new ContreteProductB();
            }
            return product;
        }

    }
}
